home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / drawfil.com / DRAWFILL.DOC < prev    next >
Encoding:
Text File  |  1989-06-09  |  20.7 KB  |  486 lines

  1.                                                                   June 9, 1989
  2.  
  3.  
  4.  
  5.                **********************************************
  6.                *                                            *
  7.                *               D R A W F I L L              *
  8.                *                                            *
  9.                *                 version 2.0                *
  10.                *                                            *
  11.                *           (c) 1989 Richard Biffl           *
  12.                *                                            *
  13.                **********************************************
  14.  
  15.  
  16.  
  17. DrawFill is a programming tool to help design graphic fill patterns for the
  18. Borland Graphics Interface (BGI) used by Borland's Turbo languages.
  19.  
  20. The command-line syntax for running DrawFill is:
  21.  
  22.        DRAWFILL [D=<driver>] [M=<mode>] [P=<path>] [R] [/A] [/C] [/R]
  23.                [/L] [/"<K>["]]
  24.  
  25.        Items in square brackets (e.g., [R]) are optional.  (All
  26.        parameters are optional.)  Items in corner brackets (e.g.,
  27.        <driver>) should be replaced as indicated in the detailed
  28.        descriptions of the parameters.  Case is ignored.  So is the
  29.        order of the parameters; but if the same parameter occurs more
  30.        than once, the last instance takes effect.  Parameters are
  31.        separated by a space or a tab.
  32.  
  33. Command-line parameters:
  34.  
  35.        D=<driver>              Driver specification
  36.  
  37.        M=<mode>                Mode-number specification
  38.  
  39.        P=<path>                Path to screen driver file (.BGI) and
  40.                                LITT.CHR
  41.  
  42.        R                       RAM-resident mode
  43.  
  44.        /A /C /R /L /"<K>"      Hot-key specifiers, for RAM-resident
  45.                                mode
  46.  
  47. Usage of these parameters is described in detail in a later section of this
  48. document.
  49.  
  50.  
  51.  
  52.                                 FILL PATTERNS
  53.  
  54. An important element of the Borland Graphics Interface is the "fill pattern." 
  55. A fill pattern is a pattern eight pixels wide and eight pixels high, which is
  56. repeated like a wallpaper pattern to fill part of the screen.  Fill patterns
  57. make any graphical output more lively, and they are especially useful in
  58. monochrome graphics as substitutes for colors.
  59.  
  60. The BGI contains the following procedures that paint fill patterns on the
  61. screen:
  62.  
  63.        Bar             Fills a rectangular area with the current fill
  64.                        style and fill color.
  65.  
  66.        Bar3D           Draws a three-dimensional bar and fills its face
  67.                        with the current fill style and fill color.
  68.  
  69.        FillEllipse     Draws an ellipse and fills it with the current
  70.                        fill style and fill color.
  71.  
  72.        FillPoly        Draws a polygon and fills it with the current
  73.                        fill style and fill color.
  74.  
  75.        FloodFill       Fills any bounded region with the current fill
  76.                        style and fill color.
  77.  
  78.        PieSlice        Draws a pie slice and fills it with the current
  79.                        fill style and fill color.
  80.  
  81.        Sector          Draws an elliptical sector and fills it with the
  82.                        current fill style and fill color.
  83.  
  84. By default, the fill style is solid and the fill color is the maximum color in
  85. the current palette.  The fill pattern can be set by calling either of the
  86. BGI's following two procedures:
  87.  
  88.        SetFillStyle    Sets a pre-defined fill pattern (see Borland
  89.                        manual for descriptions).
  90.  
  91.        SetFillPattern  Sets a user-defined fill pattern.
  92.  
  93. SetFillPattern defines a new fill pattern from a pattern definition and a
  94. color.  The pattern is defined in an array of 8 bytes, one byte for each row
  95. of pixels.  Each byte's value is the sum of the values of the lit pixels in
  96. the row.  The values of the pixels, from left-most pixel to right-most, are
  97.  
  98.            decimal notation:   128,  64,  32,  16,   8,   4,   2,   1
  99.        hexadecimal notation:   $80, $40, $20, $10, $08, $04, $02, $01
  100.  
  101. For example, a fill pattern defined by (0,0,0,0,0,0,0,0) does not light any
  102. pixels.  A fill pattern of (255,255,255,255,255,255,255,255) lights all
  103. pixels.  (3,3,3,3,3,3,3,3) draws vertical lines two pixels thick; the pixel
  104. with value 2 and the pixel with value 1 are both lit in each row. 
  105. (0,0,0,255,0,0,0,255) draws horizontal lines on every fourth row of pixels.
  106.  
  107. SetFillPattern allows the creation of fill patterns that are more interesting
  108. than straight lines.  Sketching such patterns on graph paper, though, and
  109. manually calculating their pixel-row values, is a tedious and error-prone
  110. task.  DrawFill was made to simplify the process.
  111.  
  112.  
  113.  
  114.                                USING DRAWFILL
  115.  
  116. DrawFill lets you concentrate on creativity instead of bit values.  You move a
  117. circular cursor around an eight-by-eight grid, toggling pixels on or off as
  118. you go.  The pattern you are creating, and its changing values, are displayed
  119. simultaneously next to the grid.  You can scroll the whole pattern, invert it,
  120. or change its colors until you see just what you want for your own program. 
  121. The values you need will all be on the screen, ready to copy into your
  122. program.  If you make DrawFill resident in memory, it will even do some of the
  123. copying for you.
  124.  
  125. When DrawFill starts, a command menu appears at the bottom of the screen.  The
  126. command menu lists all of the available command keys, the current state of all
  127. toggle switches, and the current graphics driver and graphics mode.  The
  128. command keys are simple:
  129.  
  130.        <arrow keys>    Move the circular cursor from pixel to pixel on
  131.                        the drawing grid, when Scroll Lock is OFF.  When
  132.                        Scroll Lock is ON, the arrow keys scroll the
  133.                        whole pattern through the drawing grid.
  134.  
  135.        Home, End       Move the cursor to the left-most and right-most
  136.                        columns, respectively.
  137.  
  138.        PgUp, PgDn      Move the cursor to the top-most and bottom-most
  139.                        rows, respectively.
  140.  
  141.        <spacebar>      Toggles the current pixel on or off.
  142.  
  143.        Ctrl-Home       Erases the current fill pattern and returns the
  144.                        cursor to the top-left pixel.
  145.  
  146.        Esc             Exits from DrawFill.
  147.  
  148.        Scroll Lock     When ON, allows the user to scroll the fill
  149.                        pattern up, down, left, or right, using the
  150.                        arrow keys.
  151.  
  152.                        NOTE:  Take care when using Scroll Lock in
  153.                        DrawFill's resident mode, if your keyboard has a
  154.                        Scroll Lock indicator.  When DrawFill pops up,
  155.                        it saves the status of the toggle keys, which is
  156.                        restored when DrawFill pops back down.  However,
  157.                        there is no way (known to me) to restore the
  158.                        status of the Scroll Lock indicator light on
  159.                        your keyboard.  Your light may therefore
  160.                        indicate the opposite of your computer's Scroll
  161.                        Lock status.  To prevent this annoyance, return
  162.                        to DrawFill's original Scroll Lock status before
  163.                        exiting from DrawFill when it is memory-
  164.                        resident.
  165.  
  166.        H               Toggles hexadecimal mode or decimal mode for
  167.                        representing the numerical values of the fill
  168.                        pattern.  Hexadecimal values are preceded by a
  169.                        dollar sign ($), as in Turbo Pascal.
  170.  
  171.        M               Toggles the graphics mode for the current screen
  172.                        driver.  The mode number is defined by the BGI
  173.                        driver; it is NOT the same as the ROM BIOS's
  174.                        mode number.
  175.  
  176.        F               Toggles the color of the fill pattern.
  177.  
  178.        S               Toggles the foreground color of the screen
  179.                        (other than the pixels which compose the fill
  180.                        pattern).
  181.  
  182.        B               Toggles the background color of the screen.
  183.  
  184.        I               Inverts the fill pattern, so that pixels that
  185.                        were lit are turned off and pixels that were off
  186.                        are turned on.
  187.  
  188.        W               Writes the code for the fill pattern as it exits
  189.                        DrawFill (available in resident mode only).  The
  190.                        pattern will be written from the point where the
  191.                        cursor was when you popped DrawFill up.
  192.  
  193.  
  194.  
  195.                            COMMAND-LINE PARAMETERS
  196.  
  197. The command-line syntax for running DrawFill is:
  198.  
  199.        DRAWFILL [D=<driver>] [M=<mode>] [P=<path>] [R] [/A] [/C] [/R]
  200.                [/L] [/"<K>["]]
  201.  
  202.        Items in square brackets (e.g., [R]) are optional.  (All
  203.        parameters are optional.)  Items in corner brackets (e.g.,
  204.        <driver>) should be replaced as indicated in the detailed
  205.        descriptions of the parameters.  Case is ignored.  So is the
  206.        order of the parameters; but if the same parameter occurs more
  207.        than once, the last instance takes effect.  Parameters are
  208.        separated by a space or a tab.
  209.  
  210.  
  211.  
  212. D=<driver>             Driver specification
  213.  
  214.        By default, DrawFill automatically uses the Borland BGI driver
  215.        that can provide the highest-quality graphics output on your
  216.        system.  The D=<driver> parameter overrides the default driver.
  217.  
  218.        The parameter specifies a Borland driver when <driver> is the
  219.        NUMBER (NOT the filename) of the appropriate Borland driver. 
  220.        Borland drivers and their numbers are listed in your Borland
  221.        manual.
  222.  
  223.        NOTE:  The IBM 8514 graphics driver and the AT&T 400-line driver
  224.        CANNOT be installed automatically; if you are using one of them,
  225.        you MUST specify either D=6 or D=8, respectively.
  226.  
  227.        Example:
  228.  
  229.                DRAWFILL D=8
  230.                        Initializes ATT400 driver (BGI driver
  231.                #8).
  232.  
  233.        You can also use the D=<driver> parameter to use a non-Borland
  234.        screen driver.  For example, if your system has the Spiffy
  235.        Graphics Array, and its manufacturer provided a driver for the
  236.        Borland Graphics Interface, you can use it by specifying the
  237.        FILENAME of the driver (NOT a number) in place of <driver>.  The
  238.        DOS path to the driver should be included if the driver is not
  239.        in the current directory or in the directory specified by the
  240.        P=<path> parameter.
  241.  
  242.        Examples:
  243.  
  244.                DRAWFILL D=SGA.BGI
  245.                        DrawFill uses the custom screen driver
  246.                in the file SGA.BGI.
  247.  
  248.                DRAWFILL D=\SPIFFY\SGA.BGI
  249.                DRAWFILL D=SGA.BGI P=\SPIFFY
  250.                        DrawFill uses the driver SGA.BGI in the
  251.                SPIFFY directory of the current disk.
  252.  
  253.        If the D=<driver> parameter specifies an invalid driver, the
  254.        error may not be detectable by DrawFill and the screen may go
  255.        blank.  If so, try pressing Esc to escape back to the DOS
  256.        prompt.  If your computer seems hopelessly locked up, reboot it
  257.        immediately to prevent the possibility of hardware damage.
  258.  
  259.  
  260.  
  261. M=<mode>               Mode-number specification
  262.  
  263.        By default, DrawFill tries to use the screen driver's mode with
  264.        the highest graphics quality.  You can override the default mode
  265.        with the M=<mode> parameter, where <mode> is a NUMBER.  The
  266.        valid modes for each Borland screen driver are listed in your
  267.        Borland manual.  A specification of an invalid mode is ignored.
  268.  
  269.        Example:
  270.  
  271.                DRAWFILL M=0
  272.                        Initializes the default driver in mode
  273.                0, which usually has the lowest resolution but
  274.                sometimes (e.g., on the CGA) has more colors
  275.                than the highest-resolution mode.
  276.  
  277.        NOTE:  Be sure to use Borland's mode number with the M=<mode>
  278.        parameter, NOT the ROM BIOS mode number.
  279.  
  280.        NOTE:  You can also change modes from within DrawFill, by
  281.        pressing <M>.
  282.  
  283.  
  284.  
  285. P=<path>               Path to screen driver file (.BGI) and LITT.CHR
  286.  
  287.        DrawFill requires the appropriate driver's .BGI file, and the
  288.        LITT.CHR font file.  (These files are not included with
  289.        DrawFill; they are included with all Borland languages that use
  290.        the Borland Graphics Interface.)
  291.  
  292.        By default, if the .BGI file is not found in the current
  293.        directory, the program will terminate with an error message.  If
  294.        the LITT.CHR file is not found, the program will run using only
  295.        the default font, which will make only a cosmetic difference.
  296.  
  297.        A path to the .BGI and LITT.CHR files may be specified on the
  298.        DrawFill command line with the P=<path> parameter.
  299.  
  300.        Example:
  301.  
  302.                DRAWFILL P=C:\TP\TPGRAPH
  303.                        Looks in the TPGRAPH subdirectory of the
  304.                TP directory on drive C.
  305.  
  306.                DRAWFILL P=..
  307.                        Looks in the parent directory above the
  308.                current subdirectory.
  309.  
  310.  
  311.  
  312. R                      RAM-resident mode
  313.  
  314.        The R parameter loads DrawFill into random-access memory, where
  315.        it resides while you run other programs.  You can pop DrawFill
  316.        up by pressing a hot-key combination.
  317.  
  318.        By default, the hot-key combination is <D> <Right Shift> <Alt>. 
  319.        (You can remember this because "DRA" are the first three letters
  320.        of "DRAwFill.")  DrawFill will pop up when you hold down the
  321.        <Right Shift> and <Alt> keys while you press <D>.  You can
  322.        change the hot-key combination with command-line parameters, as
  323.        described below.
  324.  
  325.        DrawFill has a special capability in resident mode.  It can
  326.        write the code for the pattern you create directly into whatever
  327.        program you were running when you popped DrawFill up.  Press <W>
  328.        in resident mode and DrawFill will pop down, writing the code
  329.        for your fill pattern to your screen.  This is handy when you
  330.        pop DrawFill up from an editor while writing a program that will
  331.        use your fill pattern.
  332.  
  333.        DrawFill uses almost 85,000 bytes of memory in resident mode. 
  334.        It remains resident until you reboot your computer (unless you
  335.        have a memory manager that can release resident programs without
  336.        rebooting).
  337.  
  338.        Example:
  339.  
  340.                DRAWFILL R
  341.                        Makes DrawFill resident in memory, and
  342.                reports how much memory it uses and what hot-key
  343.                combination is in effect.
  344.  
  345.        NOTE:  Because of limitations on the memory available to save
  346.        the screen, DrawFill can only be popped up from text and CGA-
  347.        graphics modes.
  348.  
  349.  
  350.  
  351. /A /C /R /L /"<K>"     Hot-key specifiers, for RAM-resident mode
  352.  
  353.        The default hot-key combination to pop DrawFill up when it is
  354.        resident is <Right Shift> <Alt> <D>.  You can change either the
  355.        hot shift-key combination, or the hot character key, or both.
  356.  
  357.        The shift keys are specified by /A for <Alt>, /C for <Ctrl>, /R
  358.        for <Right Shift>, and/or /L for <Left Shift>.  Any combination
  359.        of these four shift keys is permitted.
  360.  
  361.        The character key is specified by /"<K>", where <K> is any
  362.        character from <A> to <Z> or numeral from <0> to <9>.  The
  363.        second quotation mark is optional.
  364.  
  365.        If you change only the shift-key combination, or only the
  366.        character key, the default will be used for the other part of
  367.        the hot-key combination.
  368.  
  369.        Examples:
  370.  
  371.                DRAWFILL R /C
  372.                        Installs DrawFill in memory, with a hot-
  373.                key combination of <Ctrl> <D>.
  374.  
  375.                DRAWFILL R /"F"
  376.                        Installs DrawFill in memory, with a hot-
  377.                key combination of <Alt> <Right Shift> <F>.
  378.  
  379.                DRAWFILL R /C /"F"
  380.                        Installs DrawFill in memory, with a hot-
  381.                key combination of <Ctrl> <F>.
  382.  
  383.        The effective hot-key combination will be displayed when
  384.        DrawFill is installed in memory.
  385.  
  386.  
  387.  
  388.                            DISCLAIMER OF WARRANTY
  389.  
  390. DrawFill has been written with care, and I will make an honest effort to
  391. exterminate any bugs reported by users.  Beyond that, however, I specifically
  392. disclaim all other warranties, expressed or implied, including but not limited
  393. to implied warranties of merchantability or fitness for any particular
  394. purpose, with respect to both the software and this documentation.  In no
  395. event shall I be liable for any loss of profit or any other commercial damage,
  396. nor for any special, incidental, consequential or other damages.  I do not
  397. know of any risk in using DrawFill; but if there is a risk, the user bears it.
  398.  
  399.  
  400.  
  401.                              DISTRIBUTION POLICY
  402.  
  403. DrawFill is protected by United States copyright law and international treaty
  404. provisions.  It is not in the public domain.
  405.  
  406. You need not pay anything to use DrawFill to create fill patterns for graphics
  407. programs, either commercial or non-commercial.  (You may also use it to doodle
  408. to your heart's content.)  However, you may not incorporate DrawFill itself
  409. into another program, product, or commercial package, without my prior written
  410. consent.
  411.  
  412. You may distribute DrawFill and this documentation, provided that you
  413. distribute both DRAWFILL.EXE and DRAWFILL.DOC, TOGETHER and UNALTERED.  Please
  414. let me know of any need for patches or revisions.  If you must change one of
  415. the files yourself, you may not distribute a copy of the altered version to
  416. anyone else.
  417.  
  418. No distributor may charge for this program or documentation without my prior
  419. written consent, except that distributors may charge a nominal fee (no more
  420. than $10) to cover the costs of distribution.
  421.  
  422. The latest version of DrawFill is available from me for $10.  If you tell me
  423. which version you already have when you place your order, and it IS the latest
  424. version, I will return your money, unless you tell me you would prefer to
  425. receive an automatic upgrade when the next version is released.
  426.  
  427. Happy pixellating!
  428.  
  429.  
  430.  
  431.                **********************************************
  432.                *                                            *
  433.                *                Richard Biffl               *
  434.                *           2922 28th Street, N.W.           *
  435.                *           Washington, D.C. 20008           *
  436.                *            CompuServe 73607,3043           *
  437.                *                                            *
  438.                **********************************************
  439.  
  440.  
  441.  
  442.           DrawFill was written in Turbo Pascal and Turbo Assembler.
  443.  
  444.          RAM-resident routines are from TSRUnit by Ken L. Pottebaum,
  445.   which accompanied his article, "Creating TSR Programs with Turbo Pascal,"
  446.                  Dr. Dobb's Journal vol. 14 no. 5, May 1989.
  447.  
  448.                   DrawFill is a trademark of Richard Biffl.
  449.                Turbo Pascal and Turbo Assembler are trademarks
  450.                        of Borland International, Inc.
  451.  
  452.          ----------------end-of-author's-documentation---------------
  453.  
  454.                         Software Library Information:
  455.  
  456.                    This disk copy provided as a service of
  457.  
  458.                         The Public (Software) Library
  459.  
  460.          We are not the authors of this program, nor are we associated
  461.          with the author in any way other than as a distributor of the
  462.          program in accordance with the author's terms of distribution.
  463.  
  464.          Please direct shareware payments and specific questions about
  465.          this program to the author of the program, whose name appears
  466.          elsewhere in  this documentation. If you have trouble getting
  467.          in touch with the author,  we will do whatever we can to help
  468.          you with your questions. All programs have been tested and do
  469.          run.  To report problems,  please use the form that is in the
  470.          file PROBLEM.DOC on many of our disks or in other written for-
  471.          mat with screen printouts, if possible.  The P(s)L cannot de-
  472.          bug programs over the telephone.
  473.  
  474.          Disks in the P(s)L are updated monthly, so if you did not get
  475.          this disk  directly from the P(s)L,  you should be aware that
  476.          the files in this set may no  longer be the current versions.
  477.  
  478.          For a copy of the latest monthly software library newsletter
  479.          and a list of the 1,800+ disks in the library, call or write
  480.  
  481.                         The Public (Software) Library
  482.                               P.O.Box 35705 - F
  483.                            Houston, TX 77235-5705
  484.                                (713) 665-7017
  485.  
  486.